Hi Einar,
To use a .NET class in Navision you need to make it COM compatible and make
interfaces for the method properties you want to expose.
In Visual Studio under project/"Project Name"-properties/Configuration
Properties/Build you should set the property "Register for Com Interop" =
true, then VS will register the class for you.
I made a sample, which I hope can help you.
using System;
using System.Runtime.InteropServices;
namespace navisioncom
{
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface INavisionTest
{
int Add2Numbers(int a,int b);
}
[ClassInterface(ClassInterfaceType.None)]
//[GuidAttribute("59e333c0-c400-333e-333c-88486333104c")] use this if you
will keep the same GUID for the Class everytime you compile. Use a unique GUID
public class NavisionTest : INavisionTest
{
public NavisionTest()
{
}
public int Add2Numbers(int a,int b)
{
return(a+b);
}
}
}
In Navision you can create a testprogram
create a variable like this.
Name DataType Subtype Length
navi Automation 'navisioncom'.NavisionTest
And the simple test program.
OnRun()
CREATE(navi);
MESSAGE (FORMAT(navi.Add2Numbers(1,2)));
Hope this will help you.
Best regards
Henrik Skydtsgaard
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by einarDoes any one know of a good way to use .NET assembly in MBS Navision. I hvae
tried to use regasm.exe to register the dll as a COM object but it is not
working